/***************************************************************************
 *   Copyright (C) 2004, 2005 by tonton                                    *
 *   tontonNOSPAM@team1664.org                                             *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef G100_FONX_H
#define G100_FONX_H

#include "internal.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file g100_fonx.h
 * @author tonton1664
 * @date 2005
 * @brief Generic functions
 */

/**
 * Clear the keyboard buffer
 */
extern void __CLIB clr_kbuf ();

/**
 * Wait for a key
 */
extern uint16_t __CLIB caskey ();

/**
 * Get the current contrast of the calculator
 * @return current value of contrast
 */
extern uint8_t __CLIB get_contrast ();

/**
 * Set the contrast
 * @param cont contrast to set
 */
extern void __CLIB set_contrast (uint8_t cont);


/**
 * Set the current video page
 * Example: \c set_page(0x1A20)
 * @param page the page to move display to
 */
extern void __CLIB set_page (uint16_t page);


/**
 * Clear a video page
 * \n
 * Example : \c clr_page(0x1A20);
 * @param page the page to clear
 */
extern void __CLIB clr_page (uint16_t page);

/**
 * Clear the 3 first video pages (0x1A20-0x1AA0)
 */
extern void __CLIB clr_pages ();

/**
 * Display a bitmap
 * @param img the bitmap to display
 * @param page the page where the bitmap is going to be displayed
 */
extern void __CLIB disp_bmp (const uint8_t* img, uint16_t page);

/**
 * Remove the keyboard interrupt, allowing fast key polling
 * and speed improvement.
 * @warning Automatic power off is not disabled !
 * @see restor_int9
 */
extern void __CLIB suppr_int9 ();

/**
 * Restore the keyboard interrupt
 * @warning You must call this function \b after suppr_int9, or
 * behavior is undefined
 * @see suppr_int9
 */
extern void __CLIB restor_int9 ();

/**
 * Change the video mode.
 * Valid video modes are:
 *  - 0xC3 : normal video mode
 *  - 0xCB : valid but unused (grey)
 *  - 0xD3 : linear b/w
 *  - 0xDB : linear grey
 *
 * @param mode video mode to set
 */
extern void __CLIB set_mode (uint8_t mode);


#ifdef __cplusplus
};
#endif

#endif
